var Ynum=0
var over = false
var t = setInterval(function() {
    var nprogress = document.querySelector('.nprogress')

    // 优化1：
    if(Ynum>=95 && !over) return
    Ynum++

    if (nprogress) {
        nprogress.style.width = Ynum+'%'
    } else {
        var nprogress = document.createElement('div')
        nprogress.className = 'nprogress'
        nprogress.style.position = 'fixed'
        nprogress.style.top = 0
        // nprogress.style.width = '100%'
        nprogress.style.width = Ynum+'%'
        nprogress.style.height = '2px'
        nprogress.style.backgroundColor = 'yellowgreen'
        document.body.appendChild(nprogress) 

        // 优化2：再去搞一个圈圈
        var nprogressRadius = document.createElement('div')
        nprogressRadius.className = 'nprogressRadius'
        document.body.appendChild(nprogressRadius)
    }

    // 后续
    if (Ynum>=110) {
        document.body.removeChild(nprogress)
        clearInterval(t)

        document.body.removeChild(document.querySelector('.nprogressRadius'))
    }
}, 5)
window.onload = function() {
    over = true
}